window.getUserNameFromCookie = function (){
    const cookies = document.cookie.split(';');

    var username = null;

    for (var i = 0; i < cookies.length; i++) {
        var cookie = cookies[i].trim();

        if (cookie.startsWith('login=')) {
            var cookieValue = cookie.substring('login=username='.length);
            username = cookieValue.substring(0, cookieValue.indexOf('password'));
        }
    }
    
    return username;
}